package xyz.hzxiao.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import xyz.hzxiao.entity.order.DemoOrderEntity;
import xyz.hzxiao.order.mapper.DemoOrderMapper;
import xyz.hzxiao.order.service.DemoOrderService;
import xyz.hzxiao.result.JsonResult;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author FuXx
 * @since 2023-12-05
 */
@Service
public class DemoOrderServiceImpl extends ServiceImpl<DemoOrderMapper, DemoOrderEntity> implements DemoOrderService {

    @Override
    public JsonResult<List<DemoOrderEntity>> orderList(Integer userId) throws InterruptedException {
        TimeUnit.SECONDS.sleep(2);
        List<DemoOrderEntity> orders = this.list(new LambdaQueryWrapper<DemoOrderEntity>()
                .eq(DemoOrderEntity::getUserId, userId));
        return JsonResult.ok(orders);
    }
}
